/**
 * 
 */
package com.fpt.edu.vn.h2tv.mapper;

import java.util.ArrayList;
import java.util.List;

import com.fpt.edu.vn.h2tv.dao.entity.TbPaymentMethod;
import com.fpt.edu.vn.h2tv.dto.PaymentMethod;

/**
 * @author niteha
 *
 */
public final class PaymentMethodMapper {

	private PaymentMethodMapper() {}

	public static PaymentMethod toDTO(TbPaymentMethod paymentMethodPE) {

		if (paymentMethodPE == null) {
			return null;
		} else {
			PaymentMethod paymentMethodDTO = new PaymentMethod();
			paymentMethodDTO.setId(paymentMethodPE.getPaymentmethodid());
			paymentMethodDTO.setMethod(paymentMethodPE.getPaymentmethod());

			return paymentMethodDTO;
		}
	}

	public static List<PaymentMethod> toDTOList(List<TbPaymentMethod> paymentMethodPEList) {

		if (paymentMethodPEList == null) {
			return new ArrayList<PaymentMethod>(0);
		} else {
			List<PaymentMethod> paymentMethodDTOList = new ArrayList<PaymentMethod>(paymentMethodPEList.size());
			PaymentMethod paymentMethodDTO;
			for (TbPaymentMethod paymentMethodPE : paymentMethodPEList) {
				paymentMethodDTO = toDTO(paymentMethodPE);
				paymentMethodDTOList.add(paymentMethodDTO);
			}

			return paymentMethodDTOList;
		}
	}
}
